// NavigationDuplicated: Avoided redundant navigation to current location:
// 获取原型对象push函数
const originalPush = VueRouter.prototype.push

// 获取原型对象replace函数
const originalReplace = VueRouter.prototype.replace

// 修改原型对象中的push函数
VueRouter.prototype.push = function push(location){
  return originalPush.call(this , location).catch(err=>err)
}

// 修改原型对象中的replace函数
VueRouter.prototype.replace = function replace(location){
  return originalReplace.call(this , location).catch(err=>err)
}

const routes = [
    {
        path: '/',
        component: () => import("./views/main/MainIndex.vue"),
        meta: {
            title: '首页'
        }
    },
    {
        path: '/color',
        component: () => import("./views/color/ColorIndex.vue"),
        meta: {
            title: '颜色混合'
        }
    },
    {
        path: '/toDayWhatEat',
        component: () => import("./views/toDayWhatEat/ToDayWhatEat.vue"),
        meta: {
            title: '今天吃什么'
        }
    },
]

const router = new VueRouter({
    routes
})

router.afterEach(function (to, from){
  document.title=to.meta.title
})

// 这个不要换行
export default {routes: routes, router: router}
